from elasticsearch import Elasticsearch

# 创建Elasticsearch客户端实例
es = Elasticsearch([{'host': "192.168.0.113", 'port': 9200, 'scheme': "http"}], verify_certs=False)

# 获取所有索引的列表
indices = es.indices.get_alias(index="*")
# 删除所有索引
for index in indices:
    es.indices.delete(index=index)
    print(f"索引 {index} 已删除")

print("所有索引已成功删除")